<!DOCTYPE html>
<?php
session_start();
?>
<html>
	<head>
            
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>Botany Dichotomous Key Conversion System</title>
            <!--[if IE]>
            <link rel="stylesheet" type="text/css" href="css/index.css" />
            <link rel="stylesheet" type="text/css" href="css/stepsMenu.css" />
            <![endif]-->
            <!--[if !IE]><!-->
            <link rel="stylesheet" type="text/css" href="css/index.css" />
            <link rel="stylesheet" type="text/css" href="css/stepsMenu.css" />
            <!--<![endif]-->
            <script type="text/javascript">
           
            function samplepopup() {
            window.open( "testkey.txt", "myWindow",
            "status = 1, height = 400, width = 1000, resizable = 0" )
            }
            
            function load_file(id,ext){
             
                 if(validateExtension(ext) == false){

                      alert("Please only upload Text(.txt) file ");
                      document.getElementById("fileInput").innerHTML = "<input id='file' type='file' name='file' size='40' onChange='load_file(this.id,this.value)' required='Please Select File!'>";
                      document.getElementById(id).focus();
                      return;
                  }
             }//end of load_file

            function validateExtension(v)
            {
                 var allowedExtensions = new Array("txt","TXT");
                 for(var ct=0;ct < allowedExtensions.length;ct++)
                 {
                  sample = v.lastIndexOf(allowedExtensions[ct]);
                  if(sample != -1){return true;}
                  }
                 return false;
             }//end of validateExtension
            
            
            </script>
	</head>
	
	<body>
            <?php include("includes/header.php"); ?>
            <div id="page-wrap2">
                <div id="main-content">

                    <div id="left-col">
                        <?php include("includes/menuIndex.php"); ?>
                    </div><!-- end of left-col -->
                    
                    <div id = "right-col">
                        <h3>Welcome!!</h3>
                        <p id="welcome">Botany dichotomous Key Conversion System is a web based application that lets you generate an XML dichotomous key 
                                    which can be used in the Android and iPhone Field Identification and Data collection applications.</p>  
                        <div id="upload">
                        <h4>Step 1: Upload a text file</h4>
                        <form ENCTYPE="multipart/form-data" action ="AddBasicInfo.php" method="post">
                            <fieldset id="uploadField">
                                <?php if($_GET["expire"] == true)
                                {?>
                                <br > <p > <b><font color="red">Your session expired due to 30 minutes of inactivity.</font></b></p>
                                <?php } ?>
                                <br />
                                <p>To generate an XML dichotomous key, please upload a text file(.TXT file) containing a dichotomous key. </p> 
                                
                                <p>
                                    <div id="fileInput">
                                    <br /> <br /><input type="file" name="file" id="file" size="40" onChange="load_file(this.id,this.value)" required title="Please select a file to upload!" />
                                    </div>
                                </p>
                                <div style="text-align:center;"><br />
                                    <input type="submit" class="uploadBtn" value="Upload"/><br /> <br />
                                </div>
                            </fieldset>

                            </form>
                        </div><!-- end of upload --> 
                    </div><!-- end of right-col -->
                    
                  
                        <div id="info">
                        <h5>Additional Information</h5>
                        <fieldset id="extraInfo">
                            Dichotomous key in an input text file should be organized in Jepson Manual format(1-1', 2-2' hierarchical format).<br />
                            <button id="sampleFile" type="button" onclick="samplepopup()"> View Sample Input File </button><br />
                            Please refer <a href="Help.php" onclick="window.open('Help.php','popup','width=500,height=400,scrollbars=yes,resizable=yes,\n\
                    \n\toolbar=no,menubar=no,status=no,left=250,top=0'); return false">Help</a> for more information about the input file format <br/><br/>
                            <b>Other Links:</b><br />
                            Android App <br> <a href="https://play.google.com/store/apps/details?id=com.dkey&feature=search_result">Phlox key</a><br />
                            Prof. Marguerite C. Murphy<br /><a href="http://dbsystems.sfsu.edu/~mmurphy/">Link to Website</a> 
                        </fieldset>
                    </div><!-- end of info -->
                        
                <div class="clear"></div> <!-- all the content inside main-content div element is floated, need to clear float...
                                              because height of main-content does not know how tall it would be -->

            </div><!-- end of main-content -->   
           
        </div>  <!-- End of page-wrap -->  
       
            <?php include("includes/footer.php"); ?>
	</body>
</html>